package java_12_20;

public class Demo7 {
    public static void main(String[] args) {
        Object object=new Object();
        Thread t1 = new Thread() {
            public void run() {
                synchronized (object) {
                    while (true) {

                    }
                }
            }
        };
        Thread t2 = new Thread() {
            public void run() {
                synchronized (object) {
                    while (true) {

                    }
                }
            }
        };
        t1.start();
        t2.start();
    }
}